/**
 * Copyright(c) 2014 Xunton Solutions
 *
 * History:
 *   15-9-18 下午3:53 Created by dwzhang
 */
package com.jade.bss.weixin.api.pay.protocol;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.jade.bss.weixin.api.protocol.xml.Request;

/**
 * 统一下单接口。除被扫支付场景以外，商户系统先调用该接口在微信支付服务后台生成预支付交易单，返回正确的预支付交易回
 * 话标识后再按扫码、JSAPI、APP等不同场景生成交易串调起支付。
 *
 * @author <a href="mailto:dwzhang@xunton.com">dwzhang</a> 
 * @version 1.0 15-9-18 下午3:53
 */
@XmlRootElement (name = "xml")
@XmlAccessorType (XmlAccessType.FIELD)
public class UnifiedOrderRequest extends Request
{
    //终端设备号(门店号或收银设备ID)
    @XmlElement (name = "device_info")
    private String deviceInfo;
    //商品或支付单简要描述
    @XmlElement (name = "body")
    private String body;
    //商品名称明细列表
    @XmlElement (name = "detail")
    private String detail;
    //附加数据，在查询API和支付通知中原样返回，该字段主要用于商户携带订单的自定义数据
    @XmlElement (name = "attach")
    private String attach;
    //商户订单号 商户系统内部的订单号,32个字符内、可包含字母
    @XmlElement (name = "out_trade_no")
    private String outTradeNo;
    //货币类型
    @XmlElement (name = "fee_type")
    private String feeType = "CNY";
    //总金额
    @XmlElement (name = "total_fee")
    private int totalFee;
    //终端IP  APP和网页支付提交用户端ip，Native支付填调用微信支付API的机器IP
    @XmlElement (name = "spbill_create_ip")
    private String spbillCreateIp;
    //交易起始时间,格式为yyyyMMddHHmmss
    @XmlElement (name = "time_start")
    private String timeStart;
    //交易结束时间,格式为yyyyMMddHHmmss 最短失效时间间隔必须大于5分钟
    @XmlElement (name = "time_expire")
    private String timeExpire;
    //商品标记 商品标记，代金券或立减优惠功能的参数，
    @XmlElement (name = "goods_tag")
    private String goodsTag;
    //通知地址 接收微信支付异步通知回调地址
    @XmlElement (name = "notify_url")
    private String notifyUrl;
    //交易类型 取值如下：JSAPI，NATIVE，APP，WAP
    @XmlElement (name = "trade_type")
    private String tradeType;
    //商品ID trade_type=NATIVE，此参数必传。此id为二维码中包含的商品ID，商户自行定义
    @XmlElement (name = "product_id")
    private String productId;
    //指定支付方式 no_credit--指定不能使用信用卡支付
    @XmlElement (name = "limit_pay")
    private String limitPay;
    //用户标识,trade_type=JSAPI，此参数必传，用户在商户appid下的唯一标识。
    @XmlElement (name = "openid")
    private String openId;

    public String getDeviceInfo()
    {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo)
    {
        this.deviceInfo = deviceInfo;
        putParam("device_info", deviceInfo);
    }

    public String getBody()
    {
        return body;
    }

    public void setBody(String body)
    {
        this.body = body;
        putParam("body", body);
    }

    public String getDetail()
    {
        return detail;
    }

    public void setDetail(String detail)
    {
        this.detail = detail;
        putParam("detail", detail);
    }

    public String getAttach()
    {
        return attach;
    }

    public void setAttach(String attach)
    {
        this.attach = attach;
        putParam("attach", attach);
    }

    public String getOutTradeNo()
    {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo)
    {
        this.outTradeNo = outTradeNo;
        putParam("out_trade_no", outTradeNo);
    }

    public String getFeeType()
    {
        return feeType;
    }

    public void setFeeType(String feeType)
    {
        this.feeType = feeType;
        putParam("fee_type", feeType);
    }

    public int getTotalFee()
    {
        return totalFee;
    }

    public void setTotalFee(int totalFee)
    {
        this.totalFee = totalFee;
        putParam("total_fee", totalFee);
    }

    public String getSpbillCreateIp()
    {
        return spbillCreateIp;
    }

    public void setSpbillCreateIp(String spbillCreateIp)
    {
        this.spbillCreateIp = spbillCreateIp;
        putParam("spbill_create_ip", spbillCreateIp);
    }

    public String getTimeStart()
    {
        return timeStart;
    }

    public void setTimeStart(String timeStart)
    {
        this.timeStart = timeStart;
        putParam("time_start", timeStart);
    }

    public String getTimeExpire()
    {
        return timeExpire;
    }

    public void setTimeExpire(String timeExpire)
    {
        this.timeExpire = timeExpire;
        putParam("time_expire", timeExpire);
    }

    public String getGoodsTag()
    {
        return goodsTag;
    }

    public void setGoodsTag(String goodsTag)
    {
        this.goodsTag = goodsTag;
        putParam("goods_tag", goodsTag);
    }

    public String getNotifyUrl()
    {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl)
    {
        this.notifyUrl = notifyUrl;
        putParam("notify_url", notifyUrl);
    }

    public String getTradeType()
    {
        return tradeType;
    }

    public void setTradeType(String tradeType)
    {
        this.tradeType = tradeType;
        putParam("trade_type", tradeType);
    }

    public String getProductId()
    {
        return productId;
    }

    public void setProductId(String productId)
    {
        this.productId = productId;
        putParam("product_id", productId);
    }

    public String getLimitPay()
    {
        return limitPay;
    }

    public void setLimitPay(String limitPay)
    {
        this.limitPay = limitPay;
        putParam("limit_pay", limitPay);
    }

    public String getOpenId()
    {
        return openId;
    }

    public void setOpenId(String openId)
    {
        this.openId = openId;
        putParam("openid", openId);
    }

    public  UnifiedOrderRequest(){
        super();
        putParam("nonce_str",this.getNonceStr());

    }


}
